Repository navigation
Validation: one asynchronous IValidator<T>, given the validators of its members - #3388
Merged
david-driscoll merged 4 commits intoDec 4, 2026
Merged
Conversation
The synchronous IValidate<T> is gone, with LPAD3002, its code fix and LPAD3113. IValidateAsync<T> is now IValidator<T>, and the class shape that declares rules is IValidatorDefinition<T>. A validator none of whose rules waits answers ValidateAsync with a completed ValueTask, cancelled if the token already is and faulted if a rule throws. A member validated with its own validator, and the whole value of a [Mutable] view model, go through IValidator<T> and are always awaited. The Blazor validator validates the whole model asynchronously only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
The validator of a member validated with its own, and of the type a [Mutable] view model is of, is a constructor parameter. Where making it takes the validator being made (a type with a member of its own type, two types that validate each other) the generator finds the cycle and that validator alone is asked of an IServiceProvider when first used. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
david-driscoll
marked this pull request as ready for review
December 4, 2026 06:20
david-driscoll
enabled stacked auto-merge
December 4, 2026 06:21
|
Test Results 37 files ±0 37 suites ±0 1h 58m 10s ⏱️ + 25m 52s Results for commit afb3beb. ± Comparison against base commit 031345c. This pull request removes 46 and adds 20 tests. Note that renamed tests count towards both. |
SummarySummary
CoverageRocket.Surgery.LaunchPad.Analyzers - 92.6%
Rocket.Surgery.LaunchPad.AspNetCore - 79.7%
Rocket.Surgery.LaunchPad.AspNetCore.Mvc - 86.1%
Rocket.Surgery.LaunchPad.EntityFramework - 100%
Rocket.Surgery.LaunchPad.Foundation - 87.5%
Rocket.Surgery.LaunchPad.Foundation.Tasks - 83.9%
Rocket.Surgery.LaunchPad.Grpc - 100%
Rocket.Surgery.LaunchPad.Hosting - 100%
Rocket.Surgery.LaunchPad.HotChocolate - 35.7%
Rocket.Surgery.LaunchPad.NodaTime - 97.4%
Rocket.Surgery.LaunchPad.NodaTime.HotChocolate - 100%
Rocket.Surgery.LaunchPad.NodaTime.StrawberryShake - 100%
Rocket.Surgery.LaunchPad.Primitives - 100%
Rocket.Surgery.LaunchPad.Primitives.Analyzers - 96.4%
Rocket.Surgery.LaunchPad.Spatial - 83%
Rocket.Surgery.LaunchPad.StrawberryShake - 100%
Rocket.Surgery.LaunchPad.StrawberryShake.Spatial - 44.8%
Rocket.Surgery.LaunchPad.Validation - 72.4%
Rocket.Surgery.LaunchPad.Validation.Analyzers - 96%
Rocket.Surgery.LaunchPad.Validation.AspNetCore - 90.5%
Rocket.Surgery.LaunchPad.Validation.Blazor - 100%
Rocket.Surgery.LaunchPad.Validation.Grpc - 100%
Rocket.Surgery.LaunchPad.Validation.HotChocolate - 98%
Rocket.Surgery.LaunchPad.ZeroAlloc.AspNetCore - 65.5%
Sample.BlazorServer - 27.6%
Sample.BlazorWasm - 19.2%
Sample.Classic.Restful - 8.5%
Sample.Command - 7.2%
Sample.Core - 86.2%
Sample.Graphql.Executable - 85.8%
Sample.Grpc - 85.1%
Sample.Minimal - 70.7%
Sample.Pages - 13%
Sample.Restful - 71.7%
Sample.Worker - 2.9%
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3386. Part of #3374.
What changes
IValidate<T>(synchronous) is removed. Validation has one interface, and it is asynchronous.IValidateAsync<T>is renamedIValidator<T>.IValidator<T>, the class shape that declares rules, is renamedIValidatorDefinition<T>.ObjectValidator.TryValidateis removed.TryValidateMemberstays.What follows from it
ValidateAsyncwithout a state machine: it returns a completedValueTask, a cancelled one if the token already is, and a faulted one if a rule throws. It keeps aValidatemethod of its own (hidden from IntelliSense), which is what makes it anIValidateOptions<T>.[ValidateNested],[ValidateWith<T>]) and the whole value of a[Mutable]view model go throughIValidator<T>, so a type that has either is always awaited.TryValidateMemberanswersfalsefor such a member.IServiceProviderwhen it is first used; it finds the cycle through this compilation's validators and the constructors of referenced ones.LaunchPadValidator(Blazor) validates the whole model asynchronously only. The obsoleteEditContext.Validate()now throws for every model, not only for one with a rule that waits. A field that changes is still validated at once when its rules don't wait.Verification
dotnet build LaunchPad.slnx -c Release: 0 warnings, 0 errors.Validation.Tests(74),Validation.Analyzers.Tests(15),Validation.AspNetCore.Tests(9),Validation.Grpc.Tests(6),Validation.HotChocolate.Tests(4),Validation.Blazor.Tests(8) andSdkValidationTests(7) pass.🤖 Generated with Claude Code